<template>
  <view>
    <information :shownMaterials="courseMaterials" :showAllMaterials="showAllMaterials" :masterProductId="propagation.id"></information>
  </view>
</template>

<script>
import information from "../../../components/courseDetails/information.vue";
import {getCourseMaterials} from "../../../api/new";

export default {
  name: "moreInformation",
  components:{information},
  data(){
    return{
      // 控制是否显示更多资料
      showAllMaterials: false,
      // 课程资料数据
      courseMaterials: [],
      page: 1,
      limit: 20,
      propagation:{
        id:undefined,
        limit:10,
        page:1,
      }
    }
  },
  onLoad(options) {
    this.propagation.id=options.id
    this.getList()
  },
  onReachBottom() {
    this.getList()
  },
  methods: {
    getList(){
      getCourseMaterials(this.propagation).then(res=>{
        this.courseMaterials = [...this.courseMaterials, ...res.data];
        this.$set(this.propagation, 'page', res.data.page + 1);
      })
    }
  }
}
</script>

<style scoped lang="scss">

</style>